/* 基础类型 */
/* const count: number = 20210701; */

/* 对象类型 */
/* interface Hero {
    name: string;
    age: number;
    skill: string;
    skinNum?: number;
    say(): string; // say函数返回值为string
    [propname: string]: any; // 当前Hero可定义任意字符串类型的key
}

// 继承
interface littleSoldier extends Hero {
    rush(): string;
}

// 任意类型
interface IAnyObject {
    [key: string]: any;
}

type Hero2 = {
    name: string;
    age: number;
    skill: string;
    skinNum?: number;
}; */

/* 数组类型 */
/* interface IItem {
    id: number;
    name: string;
    isGod: boolean;
}

const objectArr: IItem[] = [{ id: 1, name: "俊劫", isGod: true }];
// or
const objectArr2: Array<IItem> = [{ id: 1, name: "俊劫", isGod: true }];

const numberArr: number[] = [1, 2, 3];

const arr: (number | string)[] = [1, "string", 2]; */

/* 元组 */
/* // 数组 某个位置的值可以是注解中的任何一个
const LOL: (string | number)[] = ["zed", 25, "darts"];

// 元祖 每一项数据类型必须一致
const LOL2: [string, string, number] = ["zed", "darts", 25]; */

/* 联合/交叉 */
/* // anjiao 某胖博主爱好
interface Waiter {
    anjiao: boolean;
    say: () => {};
}

interface Teacher {
    anjiao: boolean;
    skill: () => {};
}

// 联合类型
function judgeWho(animal: Waiter | Teacher) {}

// 交叉类型
// 同名类型会进行合并，同名基础类型属性的合并返回：never
// 同名非基础类型属性可以正常合并
function judgeWho2(jishi: Waiter & Teacher) {}

judgeWho({
    anjiao: true,
    skill: () => {
        console.log("skill called");
        return {
            name: "你妹",
        };
    },
    // say: () => {
    //     console.log("say called");
    //     return {
    //         name: "我妹",
    //     };
    // },
});

judgeWho2({
    anjiao: true,
    skill: () => {
        console.log("skill called");
        return {
            name: "你妹",
        };
    },
    say: () => {
        console.log("say called");
        return {
            name: "我妹",
        };
    },
}); */

